#!/bin/bash 

cp -Rp $1/htdocs/* $2/www/ 2>/dev/null; rm -rf $1/htdocs
cp -Rp $1/build/* $2/ 2>/dev/null; rm -rf $1/build 
cp -Rp $1/backend/* $2/usr/lib/rpcd/cgi/ 2>/dev/null;  
cp -Rp $1/hotplug.d/* $2/etc/hotplug.d/ 2>/dev/null; 
cp -Rp $1/menu.json $2/usr/share/rpcd/menu.d/$(basename $1).json 2>/dev/null 
cp -Rp $1/access.json $2/usr/share/rpcd/acl.d/$(basename $1).json 2>/dev/null
chmod +x $2/usr/bin/* 2>/dev/null
chmod +x $2/usr/lib/rpcd/cgi/* 2>/dev/null

exit 0
